home *** CD-ROM | disk | FTP | other *** search
-
- /*________________________________
- MSTst.c
- ________________________________
- OPTIONS B=token E=verb G=ASM H=ASM Src J=ASM Symb K=Debug Symb Z=No float
- ________________________________*/
- #Options +B +E -G -H +J +K +Z
- #asm
- .verbose
- #endasm
- #include "MyTools.p"
- #include "MS.h"
- #include "MST.h"
-
- /* Non-int functions */
- extern MSHdl MSGetMSH();
-
- /* function addresses passed to MSTIndxRes */
-
- pascal int PopUpMenuSelect(theMH,Top,Left,PopItem)
- MenuHandle theMH;
- short Top,Left,PopItem;
- extern 0xA80B;
-
- extern reStartProc();
- extern MSTAdjTog();
- extern MSTAdjPREV();
- extern MSTInitMenu();
- extern MSTMIVTDump();
- extern MSTDump();
-
-
- /* GLOBALS */
- TEHandle theTEH; /* for Dumps transferred to Desk Scrap */
- MSConfig MSTConfg;
-
- main()
- BEGIN_PROG
- //#asm
- // DC.W $FF01
- //#endasm
- EventRecord theEvent;
- char c;
- WindowPtr theWindow;
- short windowCode;
- long menuResult;
- int i,j;
- Rect vRect,dRect;
- Point **mTabH;
- short progNum=_MSTPRG08;
-
- MoreMasters();
- MoreMasters();
- MoreMasters();
- MoreMasters();
-
- InitMenus();
- InitCursor();
- InitDialogs(&reStartProc);
- TEInit();
- MSTConfg=MSInit(0);
- SetRect(&vRect,10000,10000,10200,10200);
- SetRect(&dRect,10000,10000,10200,10200);
- theTEH=TENew(&dRect,&vRect);
- MSTNonMS(1);
- DrawMenuBar();
-
- if (NOT(mTabH=(Point **)GetResource(_MSCFGTYP,1)))
- MSErrExit(progNum,-_MSTERR01,NULL,NULL);
- menuResult=*(long *)((*mTabH)+_MSTMMEN);
- MSTDoMenu(menuResult);
-
- FlushEvents(everyEvent);
- WHILE (TRUE)
- IF (GetNextEvent(everyEvent,&theEvent))
- THEN
- SWIT (theEvent.what)
- CASE (keyDown)
- c=theEvent.message BAND charCodeMask;
- if (theEvent.modifiers BAND cmdKey)
- MSTDoMenu(MenuKey(c));
- ENDCASE
- CASE (mouseDown)
- windowCode=FindWindow(&theEvent.where,&theWindow);
- SWIT (windowCode)
- CASE (inMenuBar)
- menuResult=MenuSelect(&theEvent.where);
- MSTDoMenu(menuResult);
- ENDCASE
- CASE (inSysWindow)
- SystemClick(&theEvent,theWindow);
- ENDCASE
- ENDSWIT
- ENDCASE
- ENDSWIT
- ENDIF
- SystemTask();
- ENDWHILE
-
- END_PROG
- //================
- reStartProc(){ExitToShell()}
- //================
- //=================
- MSTDoMenu(menuResult)
- long menuResult;
- //=================
- BEGIN_FCT
- short menuID, itemNumber;
- WindowPtr currWindow;
- MenuHandle theMH;
- Str255 paramStr[4],theStr1,theStr2;
- int itemFlg,i;
- Point **mTabH,*mTabP,mTab;
- short upper,lower,strID, strIndx,actFlg,retVal;
- short progNum=-_MSTPRG01;
- long theID,theItem,theCkBx;
- short MSerr;
- MenuVerb theMV;
- Handle theHdl;
- int (*actFct)();
-
-
- menuID=HiWord(menuResult);
- itemNumber=LoWord(menuResult);
- MSDispatch(menuID,itemNumber);
-
- if (NOT(mTabH=(Point **)GetResource(_MSCFGTYP,1)))
- MSErrExit(progNum,-_MSTERR01,NULL,NULL);
- HLock(mTabH);
- mTabP=*mTabH;
-
- FOR (itemFlg=NULL;itemFlg LT _MSTVRBL;itemFlg++)
- mTab=*(mTabP+itemFlg);
- IF (menuID EQ mTab.v)
- THEN
- if (itemFlg EQ _MSTDESK)
- break;
- if (itemFlg EQ _MSTEDIT)
- break;
- if (itemNumber EQ mTab.h)
- break;
- ENDIF
- ENDFOR
- for (i=NULL;i LT 4;i++)
- paramStr[i].count=NULL;
-
- IF (itemFlg LT _MSTVRBL)
- THEN
- SWIT (itemFlg)
- CASE (_MSTDESK)
- if (itemNumber GE (mTabP+_MSTDESK)->h)
- MSTOpenDA(menuID,itemNumber);
- ENDCASE
- CASE (_MSTEDIT)
- if (itemNumber LE (mTabP+_MSTEDIT)->h)
- SystemEdit(itemNumber-1);
- ENDCASE
- CASE (_MSTQUIT)
- MSTCloseDAs();
- ExitToShell();
- ENDCASE
- CASE (_MSTTRNF)
- MSTCloseDAs();
- DoTransfer();
- ENDCASE
- CASE (_MSTNNMS)
- MSTNonMS(0);
- DrawMenuBar();
- ENDCASE
- CASE (_MSTINSM)
- fGetIndStr(¶mStr[0],MSTConfg.prgStrID ,_MSPRG12);
- fGetIndStr(¶mStr[1],MSTConfg.altErrStrID ,_MSTERR03);
- fGetIndStr(¶mStr[2],MSTConfg.altErrStrID ,_MSTERR07);
- fGetIndStr(¶mStr[3],MSTConfg.altErrStrID ,_MSTERR04);
- ParamText(¶mStr[0],¶mStr[1],¶mStr[2],¶mStr[3]);
- WHILE (TRUE)
- MSerr=FALSE;
- IF (MSTDialog(&theID,&theStr1,&theItem,&theStr2,0))
- THEN
- for (i=NULL; i LT sizeof(MenuVerb);i++)
- *((char *)(&theMV)+i)=NULL;
-
-
- if (theStr2.count MOD 2
- OR theStr2.count GT sizeof(MenuVerb)*2)
- MSerr=TRUE;
- else
- for (i=NULL; i LT theStr2.count;i+=2)
- if ((upper=MSTHexVal(theStr2.s[i])) LT NULL
- OR (lower=MSTHexVal(theStr2.s[i+1])) LT NULL)
- MSerr=TRUE;
- else
- *((char *)(&theMV)+i/2)=upper*16+lower;
-
- if (MSerr)
- { SysBeep(20);continue;}
- MSerr=MSInsMenuItem(theID,&theStr1,theItem,&theMV);
- if (MSerr LT NULL)
- MSErrExit(_MSPRG12,-MSerr,theID,theItem);
- ENDIF
- break;
- ENDWHILE
- ENDCASE
- CASE (_MSTDELM)
- CASE (_MSTTGBT)
- CASE (_MSTPOPM)
- theID=1;theStr1.count=0;theItem=1;theStr2.count=0;
- fGetIndStr(¶mStr[2],MSTConfg.altErrStrID ,_MSTERR08);
-
- SWIT (itemFlg)
- CASE (_MSTDELM)
- fGetIndStr(¶mStr[0],MSTConfg.prgStrID ,_MSPRG13);
- ENDCASE
- CASE (_MSTTGBT)
- fGetIndStr(¶mStr[0],MSTConfg.prgStrID ,_MSPRG09);
- ENDCASE
- CASE (_MSTPOPM)
- fGetIndStr(¶mStr[0],MSTConfg.altErrStrID ,_MSTERR09);
- theItem=0;
- ENDCASE
- ENDSWIT
-
- ParamText(¶mStr[0],¶mStr[1],¶mStr[2],¶mStr[3]);
- IF (MSTDialog( theID?&theID:0, theStr1.count?&theStr1:0,
- theItem?&theItem:0, theStr2.count?&theStr2:0, 0))
- THEN
- SWIT (itemFlg)
- CASE (_MSTDELM)
- MSerr=MSDelMenuItem(theID,theItem);
- if (MSerr LT NULL)
- MSErrExit(_MSPRG13,-MSerr,theID,theItem);
- ENDCASE
- CASE (_MSTTGBT)
- MSTogBit(theID,theItem);
- ENDCASE
- CASE (_MSTPOPM)
- fGetIndStr(¶mStr[0],MSTConfg.altErrStrID ,_MSTERR05);
- ParamText(¶mStr[0],¶mStr[1],¶mStr[2],¶mStr[3]);
- MSTPopUp(theID);
- ENDCASE
- ENDSWIT
- ENDIF
- ENDCASE
- CASE (_MSTDMEN)
- CASE (_MSTMMEN)
- CASE (_MSTADJT)
- CASE (_MSTADJP)
- CASE (_MSTMIVT)
- CASE (_MSTDUMP)
- strID=MSTConfg.altErrStrID;
- theItem=_MSMSTTYP;
- actFct=NIL;
- actFlg=NULL;
- SWIT (itemFlg)
- CASE (_MSTDMEN)
- CASE (_MSTMMEN)
- strIndx=(itemFlg EQ _MSTDMEN)?_MSTERR11:_MSTERR12;
- actFlg=(itemFlg EQ _MSTDMEN)?FALSE:TRUE;
- actFct=MSTInitMenu;
- ENDCASE
- CASE (_MSTADJT)
- CASE (_MSTADJP)
- theItem=_MSPRVTYP;
- strID=MSTConfg.prgStrID;
- strIndx=(itemFlg EQ _MSTADJT)?_MSPRG08:_MSPRG10;
- actFct=(itemFlg EQ _MSTADJT)?MSTAdjTog:MSTAdjPREV;
- ENDCASE
- CASE (_MSTDUMP)
- CASE (_MSTMIVT)
- strID=MSTConfg.altPrgStrID;
- strIndx=(itemFlg EQ _MSTDUMP)?_MSTPRG06:_MSTPRG07;
- actFct=(itemFlg EQ _MSTDUMP)?MSTDump:MSTMIVTDump;
- ENDCASE
- ENDSWIT
-
- fGetIndStr(¶mStr[0],strID ,strIndx);
- ParamText(¶mStr[0],¶mStr[1],¶mStr[2],¶mStr[3]);
- IF (MSTDialog(&theID,0,0,0,&theCkBx))
- THEN
- IF (theCkBx)
- THEN
- MSTIndxRes(theItem,actFct,actFlg);
- ELSE
- (*actFct)(theID,actFlg);
- ENDIF
- DrawMenuBar();
- SWIT (itemFlg)
- CASE (_MSTDUMP)
- CASE (_MSTMIVT)
- TESetSelect(0,32767,theTEH);
- TECut(theTEH);
- /* copy TE scrap to desk scrap for DA's */
- if ((i=TEToScrap()) LT NULL)
- MSErrExit(progNum,-_MSTERR06,NULL,i);
- ENDCASE
- ENDSWIT
- ENDIF
- ENDCASE
- ENDSWIT
- ENDIF
-
- HUnlock(mTabH);
- ReleaseResource(mTabH);
- HiliteMenu(0);
-
- END_FCT
- //==========
- MSTHexVal(c)
- char c;
- //==========
- BEGIN_FCT
- IF (isdigit(c))
- THEN return (c-'30');
- ELSE c=toupper(c);
- c-='A';
- IF (c GE NULL AND c LE 5)
- THEN return (c+10);
- ELSE return (-1)
- ENDIF
- ENDIF
-
- END_FCT
-
- //=====================================
- MSTOpenDA(menuID,itemNumber)
- short menuID,itemNumber;
- //=====================================
- BEGIN_FCT
- Str255 theStr;
- WindowPtr currWindow;
- MenuHandle theMH;
- short progNum=-_MSTPRG02;
-
- GetPort(&currWindow);
- theMH=(*MSGetMSH(menuID,progNum))->MH;
- GetItem(theMH,itemNumber,&theStr);
- OpenDeskAcc(&theStr);
- SetPort(currWindow);
-
- END_FCT
- //=========
- MSTCloseDAs()
- //=========
- BEGIN_FCT
- short refNum;
-
- while ((refNum=_WINDKIND(FrontWindow())) LE NULL)
- CloseDeskAcc(refNum);
-
- END_FCT
- //================
- MSTMIVTfct(menuID,MIVTfct1,MIVTfct2)
- short menuID;
- long *MIVTfct1,*MIVTfct2;
- //=================
- /* This Function should be tailored
- to load addresses of non-PROC MIVT fcts for testing purposes*/
- BEGIN_FCT
- #define _MSTIDTDIM 1
- struct
- { short tabID;
- int tabAdd1;
- int tabAdd2;
- }IDTab[_MSTIDTDIM];
- int i;
-
- /* Init Tab to ID, MIVTfct @
- - don't forget global extern declaration */
- IDTab[NULL].tabID=-1;
- IDTab[NULL].tabAdd1=NIL;
- IDTab[NULL].tabAdd2=NIL;
- /**/
- *MIVTfct1 =NULL;
- *MIVTfct2 =NULL;
- for (i=NULL; i LT _MSTIDTDIM;i++)
- IF (IDTab[i].tabID EQ menuID)
- THEN
- *MIVTfct1 =IDTab[i].tabAdd1;
- *MIVTfct2 =IDTab[i].tabAdd2;
- break;
- ENDIF
- return;
-
- END_FCT
- //==============
- MSTNonMS(flg)
- short flg;
- //==============
- BEGIN_FCT
- Point **mTabH,*mTabP,mTab;
- MenuHandle theMH;
- short i,count;
- char before;
- short progNum=-_MSTPRG04;
-
- if (NOT(mTabH=(Point **)GetResource(_MSCFGTYP,1)))
- return;
- HLock(mTabH);
- mTabP=*mTabH;
- count=GetHandleSize((Handle)mTabH);
- count/=sizeof(Point);
- FOR (i=_MSTVRBL; i LT count;i++)
- mTab=*(mTabP+i);
- before=mTab.h BAND 0xFF00?TRUE:FALSE;
- IF ( (before AND flg) OR NOT (before OR flg) )
- THEN
- if (NOT (theMH=GetMenu(mTab.v)) )
- MSErrExit(progNum,_MSERR02,mTab.v,0);
- before=mTab.h BAND 0x00FF;
- InsertMenu(theMH,before);
- ENDIF
- ENDFOR
- HUnlock(mTabH);
-
- END_FCT
- //==================
- MSTDialog(menuID,menuStr,after,theMV,theCkBx)
- long *menuID;
- Str255 *menuStr;
- long *after;
- Str255 *theMV;
- long *theCkBx;
- //==================
- BEGIN_FCT
-
- DialogPtr theDP;
- WindowPtr currWindow;
- Str255 pStr0;
- ControlHandle theCH;
- Rect theRect;
- short itemNum,itemType;
- int retVal;
-
-
- GetPort(&currWindow);
- theDP=GetNewDialog(_MSTDLGDID,NIL,(DialogPtr)-1);
- SetPort(theDP);
- MSTDialog1(theDP,menuID,menuStr,after,theMV,theCkBx);
- itemNum=-1;
- WHILE (itemNum NE oK AND itemNum NE cancel)
- ModalDialog(NIL,&itemNum);
- IF (itemNum EQ _MSTDLGCBX)
- THEN
- GetDItem(theDP,_MSTDLGCBX,&itemType,&theCH,&theRect);
- SetCtlValue(theCH,NOT GetCtlValue(theCH));
- ENDIF
- ENDWHILE
- retVal=FALSE;
- IF (itemNum EQ oK)
- THEN
- retVal=TRUE;
- IF (menuID NE NIL)
- THEN
- GetDItem(theDP,_MSTDLGMID,&itemType,&theCH,&theRect);
- GetIText(theCH,&pStr0);
- StringToNum(&pStr0,menuID);
- ENDIF
- IF (menuStr NE NIL)
- THEN
- GetDItem(theDP,_MSTDLGSTR,&itemType,&theCH,&theRect);
- GetIText(theCH,menuStr);
- ENDIF
- IF (after NE NIL)
- THEN
- GetDItem(theDP,_MSTDLGAFT,&itemType,&theCH,&theRect);
- GetIText(theCH,&pStr0);
- StringToNum(&pStr0,after);
- ENDIF
- IF (theMV NE NIL)
- THEN
- GetDItem(theDP,_MSTDLGOPC,&itemType,&theCH,&theRect);
- GetIText(theCH,theMV);
- ENDIF
- IF (theCkBx NE NIL)
- THEN
- GetDItem(theDP,_MSTDLGCBX,&itemType,&theCH,&theRect);
- *theCkBx=GetCtlValue(theCH);
- ENDIF
- ENDIF
-
- DisposDialog(theDP);
- SetPort(currWindow);
- return(retVal);
- END_FCT
- //==================
- MSTDialog1(theDP,menuID,menuStr,after,theMV,theCkBx)
- DialogPtr theDP;
- long *menuID;
- Str255 *menuStr;
- long *after;
- Str255 *theMV;
- long *theCkBx;
- //==================
- BEGIN_FCT
-
- ControlHandle theCH;
- Rect theRect;
- PenState currPen;
- short theShort;
-
-
- GetDItem(theDP,oK,&theShort,&theCH,&theRect);
- GetPenState(&currPen);
- PenSize(2,2);
- InsetRect(&theRect,-3,-3);
- FrameRoundRect(&theRect,16,16);
- SetPenState(&currPen);
-
- SelIText(theDP,_MSTDLGMID,0,32767);
-
- if (menuID EQ NIL)
- HideDItem(theDP,_MSTDLGMID);
- if (menuStr EQ NIL)
- HideDItem(theDP,_MSTDLGSTR);
- if (after EQ NIL)
- HideDItem(theDP,_MSTDLGAFT);
- if (theMV EQ NIL)
- HideDItem(theDP,_MSTDLGOPC);
- if (theCkBx EQ NIL)
- HideDItem(theDP,_MSTDLGCBX);
-
-
- END_FCT
- //==============
- MSTPopUp(menuID)
- long menuID;
- //==============
- BEGIN_FCT
- DialogPtr theDP;
- WindowPtr currWindow;
- Str255 pStr0;
- ControlHandle theCH;
- Rect theRect;
- short theShort;
- int flg;
- long menuResult;
- MenuHandle theMH;
- MSHdl theMSH;
- short progNum=-_MSTPRG05;
-
-
- GetPort(&currWindow);
- theDP=GetNewDialog(_MSTDLGDID,NIL,(DialogPtr)-1);
- SetPort(theDP);
- HideDItem(theDP,_MSTDLGMID);
- HideDItem(theDP,_MSTDLGIDT);
- MSTDialog1(theDP,0,0,0,0);
- GetDItem(theDP,_MSTDLGICN,&theShort,&theCH,&theRect);
- LocalToGlobal(&theRect.topLeft);
- LocalToGlobal(&theRect.botRight);
- theMSH=MSGetMSH(menuID,progNum);
- theMH=(*theMSH)->MH;
- flg=FALSE;
- IF (NOT BitTst((*theMSH)->MVT, _MFSUBMEN))
- THEN
- flg=TRUE;
- DeleteMenu(menuID);
- MSInsert(menuID,-1);
- ENDIF
-
-
- WHILE (TRUE)
- ModalDialog(NIL,&theShort);
- if (theShort NE _MSTDLGICN)
- break;
-
- menuResult=PopUpMenuSelect(theMH,theRect.top,theRect.left,1);
- MSTDoMenu(menuResult);
-
- ENDWHILE
-
- IF (flg)
- THEN
- DeleteMenu(menuID);
- MSInsert(menuID,(*theMSH)->beforeID);
- DrawMenuBar();
- ENDIF
-
- DisposDialog(theDP);
- SetPort(currWindow);
- return;
-
- END_FCT
- //===========
- MSTIndxRes(typ,fct,flg)
- long typ;
- int (*fct)();
- int flg;
- //===========
- BEGIN_FCT
- short theCount;
- int i;
- Handle theHandle;
- Str255 theStr;
- short theID;
-
- theCount=CountResources(typ);
- FOR (i=1;i LE theCount;i++)
- theHandle=GetIndResource(typ,i);
- GetResInfo(theHandle,&theID,&typ,&theStr);
- (*fct)(theID,flg);
- ENDFOR
-
- END_FCT
- //=======================
- MSTDump(theID,flg)
- short theID;
- int flg;
- //=======================
- BEGIN_FCT
- /* Short by short,sprintf() MSH to TE, put in Scrap */
-
- MSHdl theMSH;
- Str255 pStr1,pStr2;
- int i,j,k,HdlSze;
- short progNum=-_MSTPRG06;
-
-
- IF (NOT (theMSH=(MSHdl)GetResource(_MSMSTTYP,theID)))
- THEN MSErrExit(progNum,_MSERR01,theID,NULL);
- ELSE
- pStr1.count=pStr2.count=NULL;
- fGetIndStr(&pStr1,MSTConfg.altErrStrID ,_MSTERR10);
- PtoCstr(&pStr1);
- sprintf(&pStr2," %s%d\n\n",&pStr1,theID);
- TEInsert(&pStr2,strlen(&pStr2),theTEH);
- HdlSze=GetHandleSize(theMSH);
- HdlSze/=sizeof(short);
- FOR (i=NULL;i LT HdlSze;i++)
- sprintf(&pStr2,"%04X ",*((unsigned short *)(*theMSH)+i));
- TEInsert(&pStr2,strlen(&pStr2),theTEH);
- ENDFOR
- sprintf(&pStr2,"\n\n");
- TEInsert(&pStr2,strlen(&pStr2),theTEH);
- ENDIF
-
-
- END_FCT
-
- /* These Functions called by MSTIndxRes with (ResID,flg) */
-
- //===================
- MSTMIVTDump(theID,flg)
- short theID;
- int flg;
- //=======================
- BEGIN_FCT
- /* Loop on MSGetMIVT, sprintf() to TE, put in Scrap */
-
- MSHdl theMSH;
- Str255 pStr1,pStr2;
- long MIVTi;
- int i,j,k,maxMIVT;
-
-
- theMSH=(MSHdl)GetResource(_MSMSTTYP,theID);
- /* this test might be changed to _MFBLDTAB */
-
- IF (BitTst((*theMSH)->MVT, _MFALOCTB))
- THEN
- pStr1.count=pStr2.count=NULL;
- fGetIndStr(&pStr1,MSTConfg.altErrStrID ,_MSTERR02);
- PtoCstr(&pStr1);
- sprintf(&pStr2," %s%d\n\n",&pStr1,theID);
- TEInsert(&pStr2,strlen(&pStr2),theTEH);
- maxMIVT=(*theMSH)->allocCount;
- FOR (i=NULL;i LE maxMIVT;i++)
- MIVTi=MSGetMIVT(theID,i);
- FOR (j=NULL;j LT (sizeof(long)/sizeof(short));j++)
- sprintf(&pStr2,"%04X ",*((unsigned short *)(&MIVTi)+j));
- TEInsert(&pStr2,strlen(&pStr2),theTEH);
- ENDFOR
- ENDFOR
- sprintf(&pStr2,"\n\n");
- TEInsert(&pStr2,strlen(&pStr2),theTEH);
- ENDIF
-
- END_FCT
- //=====================
- MSTInitMenu(theID,flg)
- short theID;
- int flg;
- //=======================
- BEGIN_FCT
- int MIVTfct1,MIVTfct2;
- IF (flg AND NOT GetMHandle(theID))
- THEN MSTMIVTfct(theID,&MIVTfct1,&MIVTfct2);
- MSMake(theID, MIVTfct1,MIVTfct2);
- MSInsert(theID, 0);
- ENDIF
- IF (NOT flg AND GetMHandle(theID))
- THEN DeleteMenu(theID);
- MSDispose(theID);
- ENDIF
-
- END_FCT
- //====================
- MSTAdjPREV(theID,flg)
- short theID;
- int flg;
- //====================
- BEGIN_FCT
- MSAdjPREV(theID);
- END_FCT
- //====================
- MSTAdjTog(theID,flg)
- short theID;
- int flg;
- //====================
- BEGIN_FCT
- Handle theHandle;
- short progNum=-_MSTPRG04;
-
- if (NOT (theHandle=GetResource(_MSPRVTYP,theID)) )
- MSErrExit(progNum,_MSERR12,theID,0);
- HLock(theHandle);
- MSAdjTog(theID,*theHandle,*theHandle+sizeof(ToggleFlag));
- HUnlock(theHandle);
- ReleaseResource(theHandle);
-
- END_FCT
- //=================
- void DoTransfer()
- //=================
- BEGIN_FCT
- SFTypeList typeList;
- short numTypes;
- IOParam volInfo;
- SFReply reply;
- Point loc;
- OSErr theErr;
-
- /* select filetypes for SFGet */
- numTypes = 1;
- typeList.ftype[0] = 'APPL';
-
- /* select the file to transfer to: use custom dialog with Transfer Button */
- SetPt(&loc,100,80);
- SFGetFile(&loc, NIL, (Ptr) NIL, numTypes, &typeList, NIL, &reply, NIL, (Ptr) NIL);
-
- /* to Finder if user cancels */
- if(reply.good != TRUE) return;
-
- /* set default volume to the one selected by user */
- volInfo.ioVRefNum = reply.vRefNum;
- volInfo.ioNamePtr = NIL;
- theErr = PBSetVol(&volInfo, FALSE);
- if(theErr) ExitToShell();
-
- /* Transfer */
- CLaunch(&reply.fName, NIL);
-
- END_FCT
- //=========
- TEToScrap()
- //=========
- BEGIN_FCT
- Ptr *TEScrapH;
- long length;
-
- HLock(TEScrapH = _TESCRPHDL);
-
- ZeroScrap();
- length = PutScrap(_TESCRPLEN, 'TEXT', *TEScrapH);
-
- HUnlock(TEScrapH);
-
- return (length);
-
- END_FCT
-